package org.practice.chart;

import java.util.Map;

public class LineChart extends FusionChart{
    /**标签<graph></graph>中定义的属性*/
    private String numVDivLines="5";
    private String chartRightMargin="40";
    private Map<String,String[]> dataMap;
    public LineChart(String caption){
        this.caption=caption;
    }

    @Override
    public String generateXML(Map<String, String[]> dataMap) {
        return null;
    }

    /**
     *
     * 拼装的数据
     * @return 返回图表XML字符串
     */
    @Override
    public String generateXML(){
        String categoriesProps=null;
        if(dataMap.containsKey("categoriesProps")){
            categoriesProps=dataMap.remove("categoriesProps")[0];
        }else {
            categoriesProps="font='Arial' fontSize='12' fontColor='000000'";
        }
        StringBuffer xml=new StringBuffer(DataTransferUtil.getChartsTitleXml(this));
        xml.append(DataTransferUtil.getChartsCategoriesXml(dataMap.get("categories"),categoriesProps));
        xml.append(DataTransferUtil.getChartsDatasetXml(dataMap,dataMap.remove("datasetProperties")));
        return xml.append("</graph>").toString();
    }

    public Map<String, String[]> getDataMap() {
        return dataMap;
    }

    public void setDataMap(Map<String, String[]> dataMap) {
        this.dataMap = dataMap;
    }
}
